#pragma GCC optimize(2, "Ofast", "inline")
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <algorithm>
#define endl '\n'
#define int long long
#define pii pair<int, int>
#define fi first
#define se second
#define int128 __int128_t
using namespace std;

// 已知
int n, q, x;
vector<int>a[111];
// 未知
int ans[111];

signed main()
{
    cin.tie(0)->ios::sync_with_stdio(false);
    cin >> n >> q;
    for (int i = 1;i <= q;++i)
    {
        cin >> x;
        if (x > 0) a[x].push_back(i);
        else
        {
            int mn = 1;
            for (int i = 1;i <= n;++i)
            {
                if (a[i].size() < a[mn].size()) mn = i;
            }
            a[mn].push_back(i);
        }
    }
    for (int i = 1;i <= n;++i)
    {
        for (int j = 0;j < a[i].size();++j)
        {
            ans[a[i][j]] = i;
        }
    }
    for (int i = 1;i <= q;++i)
    {
        cout << ans[i] << ' ';
    }
    return 0;
}